/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "contactperson")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Contactperson.findAll", query = "SELECT c FROM Contactperson c"),
    @NamedQuery(name = "Contactperson.findByContactPersonId", query = "SELECT c FROM Contactperson c WHERE c.contactPersonId = :contactPersonId"),
    @NamedQuery(name = "Contactperson.findByName", query = "SELECT c FROM Contactperson c WHERE c.name = :name"),
    @NamedQuery(name = "Contactperson.findByLastName", query = "SELECT c FROM Contactperson c WHERE c.lastName = :lastName"),
    @NamedQuery(name = "Contactperson.findByLastName2", query = "SELECT c FROM Contactperson c WHERE c.lastName2 = :lastName2"),
    @NamedQuery(name = "Contactperson.findByPhone", query = "SELECT c FROM Contactperson c WHERE c.phone = :phone"),
    @NamedQuery(name = "Contactperson.findByCellphone", query = "SELECT c FROM Contactperson c WHERE c.cellphone = :cellphone"),
    @NamedQuery(name = "Contactperson.findByAddress", query = "SELECT c FROM Contactperson c WHERE c.address = :address")})
public class Contactperson implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "contactPersonId")
    private Integer contactPersonId;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Column(name = "lastName")
    private String lastName;
    @Column(name = "lastName2")
    private String lastName2;
    @Column(name = "phone")
    private String phone;
    @Column(name = "cellphone")
    private String cellphone;
    @Column(name = "address")
    private String address;
    @JoinColumn(name = "clientId", referencedColumnName = "clientId")
    @ManyToOne
    private Client clientId;

    public Contactperson() {
    }

    public Contactperson(Integer contactPersonId) {
        this.contactPersonId = contactPersonId;
    }

    public Contactperson(Integer contactPersonId, String name, String lastName) {
        this.contactPersonId = contactPersonId;
        this.name = name;
        this.lastName = lastName;
    }

    public Integer getContactPersonId() {
        return contactPersonId;
    }

    public void setContactPersonId(Integer contactPersonId) {
        this.contactPersonId = contactPersonId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getLastName2() {
        return lastName2;
    }

    public void setLastName2(String lastName2) {
        this.lastName2 = lastName2;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getCellphone() {
        return cellphone;
    }

    public void setCellphone(String cellphone) {
        this.cellphone = cellphone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Client getClientId() {
        return clientId;
    }

    public void setClientId(Client clientId) {
        this.clientId = clientId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (contactPersonId != null ? contactPersonId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contactperson)) {
            return false;
        }
        Contactperson other = (Contactperson) object;
        if ((this.contactPersonId == null && other.contactPersonId != null) || (this.contactPersonId != null && !this.contactPersonId.equals(other.contactPersonId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Contactperson[ contactPersonId=" + contactPersonId + " ]";
    }
    
}
